package com.ayoka.utils;


import java.util.Observable;

/**
 * 会员通知事件，上层界面可以订阅此事件
 */
public class MemberEvent extends Observable {


    private volatile static MemberEvent instance;

    private MemberEvent() {
    }

    public static MemberEvent getInstance() {
        if (instance == null) {
            synchronized (MemberEvent.class) {
                if (instance == null) {
                    instance = new MemberEvent();
                }
            }
        }
        return instance;
    }

    /**
     *  通知会员状态更新
     */
    public void notifyMemberStatusChanged() {
        setChanged();
        notifyObservers();
    }

    /**
     * 清理监听
     */
    public void destroy() {
        deleteObservers();
        instance = null;
    }
}
